package com.woniu.service.liuwei.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.entity.dto.RealTimeMonitoring.chargingManage.ChargingStationDTO;
import com.woniu.mapper.ChargingStationMapper;
import com.woniu.service.liuwei.LiuChargingStationService;
import com.woniu.util.PageData;
import com.woniu.util.ResponseData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LiuChargingStationServiceImpl implements LiuChargingStationService {

    @Resource
    private ChargingStationMapper chargingStationMapper;
    @Override
    public ResponseData<?> queryChargingStation(PageData<ChargingStationDTO> pageData) {
        PageHelper.startPage(pageData.getPageNum(), pageData.getPageSize());
        List<ChargingStationDTO> chargingStationDTOS = chargingStationMapper.queryChargingStation(pageData.getParam());
        PageInfo<ChargingStationDTO> pageInfo = new PageInfo(chargingStationDTOS);
        return ResponseData.ok(pageInfo);
    }

    @Override
    public ResponseData<?> batchDel(List<Integer> ids) {
        chargingStationMapper.batchDel(ids);
        return ResponseData.ok();
    }
}
